const http = require('../../util/http')
Page({
  onShareAppMessage() {
    return {
      title: '首页',
      path: 'entry/index/index',
    };
  },
  data: {
    baseurl: http.baseURL,
    background: [],
    activityList:[],
    indicatorDots: true,
    indicatorColor: 'white',
    indicatorActiveColor: 'red',
    vertical: false,
    autoplay: true,
    circular: true,
    current: 0,
    interval: 5000,
    duration: 1000,
    mode: 'aspectFill',
    goodsList:['','','','','']
  },
  onLoad(){
    console.log('-----')
    this.featchSwipter()
    this.getActivityList()
	},
  featchSwipter(){
		http.get('/api/mini/trans/getSwiperAndGrids').then(res => {
      console.log('res',res)
			if (res.code == 200) {
				this.setData({
					background: res.swipers
				})
			}
		})
  },
  getActivityList(){
    xhs.showLoading({
      title: '加载中',
    })
    http.get('/api/activity/getActivityList').then(res => {
      console.log('res',res)
      xhs.hideLoading()
			if (res.code == 200) {
				this.setData({
          activityList:res.data
				})
			}
		})
  },
  openDetial(e) {
    console.log(e)
    const item = e.currentTarget.dataset.item
    xhs.navigateTo({
      url: '/entry/activityList/index?activityId='+item.activityId +'&productName='+item.productName+'&fileUrl='+item.fileUrl
    });
  },
  onChange(e) {
    console.log('swiper bindChange', e);
  },
});
